package com.hwua.service.impl;

import com.hwua.dao.UserDao;
import com.hwua.dao.impl.UserDaoImpl;
import com.hwua.entity.User;
import com.hwua.service.UserService;

import java.util.List;

/**
 * @author CQY
 */
public class UserServiceImpl implements UserService{
    UserDao dao=new UserDaoImpl();
    @Override
    public List<User> findAll() {
        return dao.findAll();
    }

    @Override
    public User findByName(String name) {
        User user=null;
        if(name==null || name==""){
            System.out.println("用户名输入错误");
        }else {
            user=dao.findByName(name);
            if(user==null){
                System.out.println("用户名不存在，请重新输入");
            }else {
                ;
            }
        }
        return user;
    }

    @Override
    public User findById(int id) {
        return null;
    }

    @Override
    public int save(User user) {
        return dao.save(user);
    }

    @Override
    public int delete(int id) {
        return dao.delete(id);
    }

    @Override
    public int update(User user) {
        return dao.update(user);
    }
}
